﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

// Import Standard assets CrossPlatformInput library


// TODO: Inherit BaseCharacter class
// Make start override Start method in base (inherited) class
// Call the base (inherited) class start method first
public class PlayerCharacter : BaseCharacter
{
    //used to smooth out turning
    [SerializeField]
    protected float rotateSpeed = 20.0f;

    // used to cache the character controller component attached to this character
    protected IPlayerMovement playerMovement;


    // Start is called before the first frame update
    // Make start override Start method in base (inherited) class
    protected override void Start()
    {
        // Call the base (inherited) class start method first
        base.Start();

        // Get and cache the character controller component attached to the game object this script is attached to
        playerMovement = GetComponent<IPlayerMovement>();
    }

    // Update is called once per frame
    void Update()
    {
        // Check if player character has switched to combat mode. If yes, toggle non combat mode



        // Check if player character is attacking
        // If yes, call Attack method, else move player
        if (IsAttacking())
        {

        } else
        {
            // If player movement component is not null, 
            // Get the movement from the current movement strategy and move the player

            if (playerMovement != null)
            {
                Vector3 movement = playerMovement.GetMovement(speed, runSpeedMultiplier, rotateSpeed);
                Move(movement);
            }
        }

    }


    // Override IsAttacking method
    // Check if player is pressing the right mouse button, the player is attacking
    protected override bool IsAttacking()
    {
        return Input.GetMouseButton(1);
    }
}
