public CharacterMoveState(Character parent, IGamePad pad)
     : base(parent)
 {
     gamepad = pad;
     animation = character.animation as CharacterAnimationController;
     Init();
 }
Example #2
0
    // Start is called before the first frame update
    private void Init()
    {
        CharacterParam.Name     = CharacterName;
        CharacterParam.HitPoint = CharacterHP;

        CharacterParam.MagicPoint = CharacterMp;

        CharacterParam.Speed = CharacterSpeed;

        CharacterParam.CharacterType = CharacterType;

        CharacterParam.Attack = CharacterAttack;

        CharacterParam.IsEnemy = IsEnemy;

        if (!IsEnemy)
        {
            CharacterParam.FirstButtonAction  = FirstButtonAction;
            CharacterParam.SecondButtonAction = SecondButtonAction;
            CharacterParam.ThirdButtonAction  = ThirdButtonAction;
            CharacterParam.FourthButtonAction = FourthButtonAction;
        }
        else
        {
            attackSpan = 10f;
        }
        CharacterAnimationController = this.gameObject.GetComponent <CharacterAnimationController>();
    }
Example #3
0
 public CharacterMoveState(Character parent, IGamePad pad)
     : base(parent)
 {
     gamepad   = pad;
     animation = character.animation as CharacterAnimationController;
     Init();
 }
Example #4
0
 void Start()
 {
     box      = GetComponent <BoxCollider2D>();
     statusP  = GetComponentInParent <PlayerStats>();
     statusE  = GetComponentInParent <EnemyStats>();
     artifact = GetComponentInParent <Artifact>();
     anim     = GetComponentInParent <CharacterAnimationController>();
 }
Example #5
0
    void Start()
    {
        _animationController = GetComponent<CharacterAnimationController>();
        _rigidbody = GetComponent<Rigidbody>();
        _soundController = SoundController.Instance;

        _particleManager = ParticleManager.Instance;
    }
    // The View is the Unity GameObject and Animator. They don't need seperate classes here.
    // ----------------------------------------------- End Data members ------------------------------------------

    // --------------------------------------------------- Methods -----------------------------------------------
    // --------------------------------------------------------------------
    // Use this for initialization
    void Awake()
    {
        // Setting up references to other objects.
        playerMovement      = GetComponent <PlayerMovement>();
        animationController = GetComponent <CharacterAnimationController>();
        state = GetComponent <PlayerStates>();
        anim  = GetComponent <Animator>();
    }
 private void Awake()
 {
     characterMovement  = GetComponent <CharacterMovementController>();
     characterAnimation = GetComponent <CharacterAnimationController>();
     characterCombat    = GetComponent <CharacterCombat>();
     health             = GetComponent <Health>();
     rigidBody2D        = GetComponent <Rigidbody2D>();
 }
Example #8
0
 public override void Update(GameTime time)
 {
     Move(time);
     currentAnimation   = path.Count > 0 ? moveAnimation : idleAnimation;
     currentAnimation.X = X;
     currentAnimation.Y = Y;
     currentAnimation.Update(time);
 }
Example #9
0
 public CharacterBaseState(CharacterModel characterModel, InputModel inputModel, CharacterAnimationController animationController,
                           CharacterStateMachine stateMachine)
 {
     _characterModel      = characterModel;
     _inputModel          = inputModel;
     _animationController = animationController;
     _stateMachine        = stateMachine;
 }
 public override void Awake()
 {
     InputManager       = GetComponent <InputManager>();
     charAnimController = GetComponent <CharacterAnimationController>();
     EquipWeapon(weaponPrefab);
     timeController = GetComponent <TimeController>();
     base.Awake();
     UIManager.Instance.RegisterPlayer(this);
 }
Example #11
0
 void Start()
 {
     overview = GameObject.Find("DialogueView2");
     choice   = GameObject.Find("ChoiceManager").GetComponent <Choices>();
     origin   = overview.transform.position;
     dateCharacterController = GameObject.FindGameObjectWithTag("DateCharacter").GetComponent <CharacterAnimationController>();
     sceneLoader             = SceneLoader.SceneLoaderInstance;
     StartCoroutine(StartGame());
 }
Example #12
0
 public DancingState(CharacterModel characterModel, InputModel inputModel, CharacterAnimationController animationController,
                     CharacterStateMachine stateMachine) : base(characterModel, inputModel, animationController, stateMachine)
 {
     Type           = StateType.Default;
     IsTargeting    = false;
     IsAttacking    = false;
     CanExit        = false;
     CanBeOverriden = true;
 }
    private void Awake()
    {
        equipment           = GetComponent <PlayerEquipment>();
        mysql               = FindObjectOfType <Mysql>();
        animationController = GetComponentInChildren <CharacterAnimationController>();
        mouseLook           = GetComponent <mouseLook>();

        respawnUpdateTime = Time.time;
    }
Example #14
0
 public PlayerMover(ICharacterInput input, Transform objectToMove, CharacterSettings settings)
 {
     _input           = input as PlayerInput;
     _objectToMove    = objectToMove;
     _settings        = settings;
     _objectToMoveRig = objectToMove.GetComponent <Rigidbody>();
     _charAnim        = objectToMove.GetComponentInChildren <CharacterAnimationController>();
     _speed           = new SpeedParams(settings.Speed);
     currentSpeed     = _speed.walk;
 }
Example #15
0
 public override void InitScene()
 {
     foreach (KeyValuePair <string, Action> sceneEvent in GetSceneEventMethods(this))
     {
         AddHandler(sceneEvent.Key, sceneEvent.Value);
     }
     MysteryManController    = MysteryMan.GetComponent <CharacterAnimationController>();
     MedicController         = Medic.GetComponent <CharacterAnimationController>();
     MysteryManIntroDialogue = MysteryManIntroDialogueObject.GetComponent <MysteryManIntro>();
 }
Example #16
0
    private void Awake()
    {
        animationController = GetComponentInChildren <CharacterAnimationController>();
        controller          = GetComponent <CharacterController>();
        agent           = GetComponent <NavMeshAgent>();
        playerCharacter = GetComponent <PlayerCharacter>();

        path        = new NavMeshPath();
        elapsed     = 0.0f;
        agent.speed = walkSpeed;
    }
Example #17
0
    void Start()
    {
        rbody          = GetComponent <Rigidbody>();
        animController = GetComponent <CharacterAnimationController>();
        NavMeshAgent agent = GetComponent <NavMeshAgent>();

        if (agent != null)
        {
            gameObject.GetComponent <NavMeshAgent>().isStopped = true;
            gameObject.GetComponent <NavMeshAgent>().speed     = navMoveSpeed;
        }
    }
    void Start()
    {
        GameObject player = GameObject.FindGameObjectWithTag("Player");

        stat  = player.GetComponent <PlayerStats>();
        anim  = player.GetComponent <CharacterAnimationController>();
        money = GetComponent <Money>();
        if (Instance == null)
        {
            Instance = this;
        }
    }
    public AIMover(ICharacterInput input, GameObject objectToMove, CharacterSettings settings)
    {
        _settings     = settings;
        _objectToMove = objectToMove;
        _input        = input as AIInputNav;
        _charAnim     = objectToMove.GetComponentInChildren <CharacterAnimationController>();
        _speed        = new SpeedParams(settings.Speed);
        Vector3 startPos = _settings.Path.transform.GetChild(0).position;

        SetStartPosition(startPos);
        CreateNavMeshAgent();
    }
Example #20
0
 void Awake()
 {
     _characterData     = GetComponent <CharacterData>();
     _characterMovement = GetComponent <CharacterMovement>();
     _characterRotation = GetComponent <CharacterRotation>();
     _characterAttack   = GetComponent <CharacterAttack>();
     _characterAnimCtrl = GetComponent <CharacterAnimationController>();
     _characterLauncher = GetComponent <CharacterLaunchProjectile>();
     _isPlayer          = gameObject.CompareTag("Player");
     if (_isPlayer)
     {
         _playerInput = GetComponent <PlayerInput>();
     }
 }
Example #21
0
    public static void OnPlayerAttack(PlayerCharacter receiver, Collider other)
    {
        PlayerCharacter attacker = other.GetComponent <Weapon>().player.GetComponent <PlayerCharacter>();

        if (attacker.id != receiver.id)
        {
            CharacterAnimationController animationController = attacker.GetComponentInChildren <CharacterAnimationController>();
            if (animationController.currentAttack != null && !animationController.currentAttack.done)
            {
                animationController.currentAttack.done = true;
                DoDamage(attacker, receiver, animationController.currentAttack);
            }
        }
    }
    public void InitializeCharacter(CharacterSettings settings)
    {
        this.settings = settings;
        isPlayer      = !settings.IsAi;
        isAlive       = true;

        //create input for player or AI nav
        input = !isPlayer ? new AIInputNav(settings, transform, this) as ICharacterInput : new PlayerInput(transform);
        //create mover
        characterMover = !isPlayer ? new AIMover(input, gameObject, settings) as ICharacterMover : new PlayerMover(input, transform, settings);
        //create character combat
        characterCombat = new CharacterCombat(input, settings.Health, gameObject, this);
        charAnim        = gameObject.GetComponentInChildren <CharacterAnimationController>();
    }
Example #23
0
 void Start()
 {
     mainCamera = GameObject.FindWithTag("MainCamera");
     if (GameObject.FindWithTag("Player") != null)
     {
         charController = GameObject.FindWithTag("Player").GetComponent <ThirdPerson3D>();
         playInt        = charController.transform.GetComponent <Player_Interaction>();
         //		navAgent = charController.transform.GetComponent<NavMeshAgent>();
         cfo            = GameObject.Find("Camera Look Target").GetComponent <CameraFollowOrbit>();
         animController = anim.transform.GetComponent <CharacterAnimationController>();
         origin         = GameObject.Find("Camera Move Target").transform;
         destination    = origin;
     }
     this.enabled = false;
 }
Example #24
0
    private void Start()
    {
        bool a = IsEnemy;

        if (a == false)
        {
            CharacterParam.FirstButtonAction  = FirstButtonAction;
            CharacterParam.SecondButtonAction = SecondButtonAction;
            CharacterParam.ThirdButtonAction  = ThirdButtonAction;
            CharacterParam.FourthButtonAction = FourthButtonAction;

            //キャラクターの一番目のボタンの行動でパラメーターがきまる・・??

            CharacterAnimationController = GetComponent <CharacterAnimationController>();
        }
    }
    // Use this for initialization
    private void Start()
    {
        base.Start();

        cameraTransform = Camera.main.transform;

        characterCon = GetComponent <CharacterController>();
        if (characterCon == null)
        {
            Debug.LogError("need Component CharacterController");
        }

        chaAnimationCon = animationCon as CharacterAnimationController;
        if (chaAnimationCon == null)
        {
            Debug.LogError("need Component CharacterAnimationController");
        }

        chaAnimationCon.SetAttackSpeed(attackSpeed);
        chaAnimationCon.SetMoveSpeed(moveSpeed);

        maxhp        = PlayerData.CurrentHP;
        mpRate       = PlayerData.CurrentPOWERADD;
        attackDamage = PlayerData.CurrentATK;
        attackSpeed  = PlayerData.CurrentAS;
        moveSpeed    = PlayerData.CurrentMS;
        currenthp    = maxhp;
        currentmp    = maxmp;

        isControl = true;
        if (PlayerData.TECHGRADE.Count == 3)
        {
            skills[1].damageFactor *= (PlayerData.TECHGRADE[0] * 0.05f + 1.0f);
            skills[2].damageFactor *= (PlayerData.TECHGRADE[1] * 0.05f + 1.0f);
            skills[3].damageFactor *= (PlayerData.TECHGRADE[2] * 0.05f + 1.0f);
        }

        bloodChangeEvent.Invoke(maxhp, currenthp);
        energyChangeEvent.Invoke(maxmp, currentmp);
        //Debug.Log(PlayerData.CurrentATK.ToString() + "," + PlayerData.CurrentAS.ToString() + "," + PlayerData.CurrentMS.ToString() + "," + PlayerData.CurrentPOWERADD.ToString());

        updatePlayData.Invoke(attackDamage, attackSpeed, moveSpeed, mpRate);
        if (showEffect != null)
        {
            Instantiate(showEffect, transform.position, transform.rotation);
        }
    }
Example #26
0
 /// <summary>
 /// Called from the Player Class, this sets the timescale to be slowed down and speeds up the animator so the
 /// player moves at the same speed relative to the world in realtime
 /// </summary>
 public void DoSlowMotion(CharacterAnimationController animatorController)
 {
     if (!(Time.time >= nextUse))
     {
         return;
     }
     Time.timeScale = slowDownFactor;
     timeMultiplier = 1 / slowDownFactor;
     characterAnimationController            = animatorController;
     originalRotation                        = animatorController.rotationSpeed;
     animatorController.rotationSpeed        = originalRotation * timeMultiplier;
     characterAnimationController.anim.speed = timeMultiplier;
     originalFixedTime                       = Time.fixedDeltaTime;
     Time.fixedDeltaTime                     = Time.timeScale * 0.02f;
     exitTime = Time.time + (slowDownLength * slowDownFactor);
     slowMo   = true;
 }
Example #27
0
    public CharacterCombat(ICharacterInput input, float health, GameObject character, MonoBehaviour myMonoBehaviour)
    {
        _health             = health;
        _input              = input;
        _characterObject    = character;
        _myMonoBehaviour    = myMonoBehaviour;
        _character          = character.GetComponent <Character>();
        _characterField     = character.GetComponent <FieldOfView>();
        _characterRigidbody = character.GetComponent <Rigidbody>();
        _agent              = character.GetComponent <NavMeshAgent>();
        _charAnim           = character.GetComponentInChildren <CharacterAnimationController>();

        if (_character.isPlayer)
        {
            UIController.instance.UpdateHealthUI(_health);
        }
    }
Example #28
0
    void Start()
    {
        raycastCollider = GetComponent <RaycastCollider2D>();
        input           = GetComponent <InputManager>();
        timers          = GetComponent <Timers>();
        stats           = GetComponent <PlayerStats>();
        sprite          = GetComponent <SpriteRenderer>();
        anim            = GetComponent <CharacterAnimationController>();

        // Init all timers
        timers.RegisterTimer("jumpBuffer", inputBufferTimeSeconds);
        timers.RegisterTimer("coyoteBuffer", coyoteTimeSeconds);
        timers.RegisterTimer("platformFallThrough", platformFallThroughSeconds);
        timers.RegisterTimer("dashBuffer", dashCooldownSeconds);

        // make teleporter sprite deactivated
        teleporter.GetComponent <Renderer>().enabled = false;
    }
    // Start is called before the first frame update
    private void Init()
    {
        CharacterParam.HitPoint = CharacterHP;

        CharacterParam.MagicPoint = CharacterMp;

        CharacterParam.Speed = CharacterSpeed;

        CharacterParam.CharacterType = CharacterType;

        //キャラクターの一番目のボタンの行動でパラメーターがきまる・・??
        CharacterParam.FirstButtonAction  = FirstButtonAction;
        CharacterParam.SecondButtonAction = SecondButtonAction;
        CharacterParam.ThirdButtonAction  = ThirdButtonAction;
        CharacterParam.FourthButtonAction = FourthButtonAction;

        CharacterAnimationController = GetComponent <CharacterAnimationController>();
    }
    public MovementStrategyAbstract(CharacterController characterControllerRef)
    {
        characterController = characterControllerRef;
        rBody          = characterControllerRef.GetComponent <Rigidbody2D>();
        animController = characterControllerRef.GetComponent <CharacterAnimationController>();

        walkSpeed   = characterControllerRef.GetWalkSpeed();
        crouchSpeed = characterControllerRef.GetCrouchSpeed();
        jumpSpeed   = characterControllerRef.GetJumpSpeed();

        maxJumpCount      = characterControllerRef.GetMaxJumpCount();
        gravityMultiplier = characterControllerRef.GetGravityMultiplier();

        characterTransform = characterControllerRef.GetComponent <Transform>();

        groundCheck  = characterControllerRef.GetGroundCheckTransform();
        whatIsGround = characterControllerRef.GetWhatIsGroundLayerMask();
    }
Example #31
0
    /// <summary>
    /// 外部のオブジェクトを参照するデータの初期化
    /// </summary>
    protected void InitData()
    {
        mapManager = GameObject.Find("map_manager").GetComponent <MapManager>();

        state = new CharacterStayState(this, parent.gamepad);


        animation = new CharacterAnimationController(sprite);

        //チーム設定
        baseParameter.team = new Team(parent.team.name);
        //初期ポジション設定
        baseParameter.mapPosition = mapManager.mapParameter.GetFirstPosition(parent.number);

        var screenPos = baseParameter.mapPosition.GetScreenPositionByMapPosition();

        transform.localPosition = new Vector3(screenPos.x,
                                              screenPos.y,
                                              transform.localPosition.z);
    }
 void Start()
 {
     characterAnimationController = GetComponent<CharacterAnimationController>();
 }
Example #33
0
    /// <summary>
    /// �O���̃I�u�W�F�N�g��Q�Ƃ���f�[�^�̏�����
    /// </summary>
    protected void InitData()
    {
        mapManager = GameObject.Find("map_manager").GetComponent<MapManager>();

        state = new CharacterStayState(this, parent.gamepad);

        animation = new CharacterAnimationController(sprite);

        //�`�[���ݒ�
        baseParameter.team = new Team(parent.team.name);
        //�����|�W�V�����ݒ�
        baseParameter.mapPosition = mapManager.mapParameter.GetFirstPosition(parent.number);

        var screenPos = baseParameter.mapPosition.GetScreenPositionByMapPosition();
        transform.localPosition = new Vector3(screenPos.x,
                                                screenPos.y,
                                                  transform.localPosition.z);
    }
	// Use this for initialization
	void Start ()
	{
		current = this;
	}