void Awake()
 {
     // Setting up the references.
     player            = GameObject.FindGameObjectWithTag("Player");
     ayyPlay           = GameObject.FindGameObjectWithTag("Player").GetComponent <DragonController>();
     enemyHealth.value = maxHealth;
 }
    public void attackDragon()
    {
        if (target == null)
        {
            return;
        }

        DragonController dragonController = target.GetComponent <DragonController> ();

        int dmg = PlayManager.Instance.pushDamagePhysics(controller.attribute.ATK.Min,
                                                         controller.attribute.ATK.Max,
                                                         dragonController.attribute.DEF);

        dragonController.attribute.HP.Current -= dmg;

        //show collision
        PlayDragonManager.Instance.showEnemyAttackCollision(target);

        if (dragonController.attribute.HP.Current < 0)
        {
            dragonController.attribute.HP.Current = 0;
        }

        float valueTo = dragonController.attribute.HP.Current / (float)dragonController.attribute.HP.Max;

        dragonController.updateTextHP();

        EffectSupportor.Instance.runSliderValue(dragonController.sliderHP, valueTo, EffectSupportor.TimeValueRunHP);
        EffectSupportor.Instance.runSliderValue(PlayDragonInfoController.Instance.sliderHP, valueTo, EffectSupportor.TimeValueRunHP);
    }
示例#3
0
 public DragonExplode(UnityEngine.Vector3[] wayPoints, DragonController dragonController)
 {
     // TODO: Complete member initialization
     this.wayPoints        = wayPoints;
     this.dragonController = dragonController;
     actionID = (int)DragonController.Transition.Explode;
 }
示例#4
0
 protected void Awake()
 {
     dragonController = FindObjectOfType <DragonController>();
     player           = FindObjectOfType <PlayerController>();
     enterTerritory   = FindObjectOfType <EnterTerritory>();
     screenShake      = GetComponentInChildren <ScreenShake>();
 }
    void attackPlayerDragon(DragonController dragon)
    {
        dragon.dragonAttack.listEnemy.Add(this.transform.parent.gameObject);
        dragon.dragonAttack.chooseEnemyToAttack();

        attack(dragon.gameObject);
    }
示例#6
0
    public IDragonState HandleInput(DragonController dragon, IHandleInput input)
    {
        if (dragon.isFlinching)
        {
            return(new FlinchingState());
        }

        if (dragon.executingAction)
        {
            return(null);
        }

        if (input.Action() != null)
        {
            if (input.Action().CommandName().Equals("fire"))
            {
                return(new FiringState());
            }
            else if (input.Action().CommandName().Equals("deflect"))
            {
                return(new DeflectingState());
            }
            else if (input.Action().CommandName().Equals("dash"))
            {
                return(new DashingState());
            }
        }

        if (input.Move() != Vector3.zero)
        {
            return(new RunningState());
        }

        return(null);
    }
示例#7
0
    void attackPlayerDragon(DragonController dragon)
    {
        dragon.dragonAttack.listEnemy.Add(this.transform.parent.gameObject);
        dragon.dragonAttack.chooseEnemyToAttack();

        attack(dragon.gameObject);
    }
示例#8
0
    /// <summary>
    /// 判断是否攻击到了怪物
    /// </summary>
    /// <param name="hurt"></param>
    void AttackMonster(float hurt)
    {
        for (int i = 0; i < MonsterManager.sMonsterManager.MonsterLst.Count; i++)
        {
            GameObject       monster = MonsterManager.sMonsterManager.MonsterLst[i];
            DragonController ctr     = monster.GetComponent <DragonController>();
            if (ctr.IsDeath())
            {
                continue;
            }

            Vector3 dir = monster.transform.position - transform.position;
            if (dir.magnitude > mAttackLen)
            {
                continue;
            }

            float cos = Vector3.Dot(dir.normalized, transform.forward);
            if (cos <= 0.2f)
            {
                continue;
            }

            ctr.GetHit(hurt);
        }
    }
示例#9
0
        private void TrackDragonStats(int playerID, DragonController dc)
        {
            var psd = gManager.GetPlayerStatsData(playerID);

            dc.OnFireball += () => psd.Fireballs++;
            dc.OnStomp    += () => psd.Stomps++;
            dc.OnFlap     += () => psd.Flaps++;
        }
示例#10
0
 // Use this for initialization
 void Start()
 {
     ayylmao        = GameObject.FindGameObjectWithTag("Player").GetComponent <DragonController>();
     thishealth     = this.GetComponent <EnemyHealth>();
     buildinglister = GameObject.FindGameObjectWithTag("Blister").GetComponent <BuildingLister> ();
     npclister      = GameObject.FindGameObjectWithTag("NPCLister").GetComponent <NPCLister> ();
     npclister.AddRun(this.gameObject);
 }
示例#11
0
 //
 void Awake()
 {
     _headIK          = GetComponent <DragonHeadIK>();
     _character       = GetComponent <iMalbersInputs>() as DragonController;
     _lookAtScript    = GetComponent <VRLookAtDragon>();
     _character.Fly   = true;
     _targetTransform = startTransfom;
 }
示例#12
0
 // Use this for initialization
 void Start()
 {
     ayylmao         = GameObject.FindGameObjectWithTag("Player").GetComponent <DragonController>();
     thishealth      = this.GetComponent <EnemyHealth>();
     currentfastness = origfastness;
     currentRotSped  = origrotationSpeed;
     npclister       = GameObject.FindGameObjectWithTag("NPCLister").GetComponent <NPCLister> ();
     npclister.AddAttack(this.gameObject);
 }
示例#13
0
    void OnTriggerExit(Collider other)
    {
        DragonController mydrago = other.GetComponent <DragonController>();

        if (mydrago)
        {
            mydrago.ActionID = -1;
        }
    }
示例#14
0
    void OnTriggerEnter(Collider other)
    {
        DragonController mydrago = other.GetComponent <DragonController>();

        if (mydrago)
        {
            mydrago.ActionID = (int)actionEmotions;
        }
    }
    public void Start()
    {
        Transform t = transform;

        while (_dragonController == null && t != null)
        {
            _dragonController = t.GetComponent <DragonController>();
            t = t.parent;
        }
    }
示例#16
0
 // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
 override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     //Get the Take off Point to compare if is falling
     MaxJumpPoint = animator.transform.position.y;
     animator.SetFloat("DragoFloat", 1);
     animator.SetInteger("DragoInt", 1);
     animator.applyRootMotion = true;
     myDrago           = animator.GetComponent <DragonController>();
     myDrago.MaxHeight = 0;
 }
示例#17
0
    protected void Awake()
    {
        myCollider       = GetComponent <Collider2D>();
        playerController = FindObjectOfType <PlayerController>();
        cameraFollow     = FindObjectOfType <CameraFollow>();
        dragonController = FindObjectOfType <DragonController>();
        floorDetector    = FindObjectOfType <FloorDetector>();


        //dragonStartPosition = new Vector3(dragon.transform.position.x, dragon.transform.position.y, -11);
    }
示例#18
0
    public DragonDisappear(UnityEngine.Vector3[] wayPoints, DragonController dragonController)
    {
        // TODO: Complete member initialization
        this.wayPoints        = wayPoints;
        this.dragonController = dragonController;
        actionID = (int)DragonController.FSMActionID.Disappear;
        animator = dragonController.Animator;

        info.name = "idle";
        info.id   = 0;
    }
示例#19
0
    public DragonBeat(UnityEngine.Vector3[] wayPoints, DragonController dragonController)
    {
        // TODO: Complete member initialization
        this.wayPoints        = wayPoints;
        this.dragonController = dragonController;
        actionID = (int)DragonController.FSMActionID.Beat;
        animator = dragonController.Animator;

        info.name = "attack1";
        info.id   = 5;
    }
示例#20
0
    public DragonHold(UnityEngine.Vector3[] wayPoints, DragonController dragonController)
    {
        // TODO: Complete member initialization
        this.wayPoints        = wayPoints;
        this.dragonController = dragonController;
        actionID = (int)DragonController.FSMActionID.Hold;
        animator = dragonController.Animator;

        info.name = "hold";
        info.id   = 3;
    }
示例#21
0
    // Use this for initialization
    void Start()
    {
        currentScenario = 0;
        lastScenario    = 0;
        DelayScenario   = GameOverScenario - 1;
        this.gameObject.GetComponent <SpriteRenderer>().sprite = face_neutral;
        dragon       = GameObject.Find("Dragon").GetComponent <DragonController>();
        stressButton = GameObject.Find("Stress Button").GetComponent <StressController>();

        timer = maxResponseTime;

        InitScript();
        LoadScenario(currentScenario);
    }
示例#22
0
    void OnTriggerEnter(Collider other)
    {
        if (other.tag == TagHashIDs.ColliderForEnemyATK)
        {
            if (controller.attribute.HP.Current <= 0)
            {
                return;
            }

            if (other.transform.parent.GetComponent <DragonController>() != null)
            {
                DragonController dragonController = other.transform.parent.GetComponent <DragonController>();

                if (dragonController.StateOffense == EDragonStateOffense.NONE &&
                    dragonController.attribute.HP.Current > 0 &&
                    !dragonController.dragonAttack.listEnemy.Contains(this.transform.parent.gameObject) &&
                    !listDragon.Contains(other.transform.parent.gameObject))
                {
                    //attackPlayerDragon(dragonController);
                    listDragon.Add(other.transform.parent.gameObject);
                }

                if (controller.StateAction == EEnemyStateAction.MOVE && controller.stateAttack.target == null &&
                    dragonController.StateAction != EDragonStateAction.ATTACK &&
                    dragonController.StateAction != EDragonStateAction.MOVE)
                {
                    chooseDragonToAttack();
                }
            }
            else
            {
                BabyDragonController babyController = other.transform.parent.GetComponent <BabyDragonController>();

                if (babyController.attribute.HP.Current > 0 &&
                    !babyController.babyAttack.listEnemy.Contains(this.transform.parent.gameObject) &&
                    !listDragon.Contains(other.transform.parent.gameObject))
                {
                    //attackPlayerDragon(dragonController);
                    listDragon.Add(other.transform.parent.gameObject);
                }

                if (controller.StateAction == EEnemyStateAction.MOVE && controller.stateAttack.target == null &&
                    babyController.StateAction != EDragonStateAction.ATTACK &&
                    babyController.StateAction != EDragonStateAction.MOVE)
                {
                    chooseDragonToAttack();
                }
            }
        }
    }
示例#23
0
    public void chooseDragonToAttack()
    {
        if (controller.stateAttack.target == null && listDragon.Count > 0)
        {
            bool hasTarget = false;
            for (int i = 0; i < listDragon.Count; i++)
            {
                if (listDragon[i] == null)
                {
                    break;
                }

                if (listDragon[i].activeSelf)
                {
                    if (listDragon[i].GetComponent <DragonController>() != null)
                    {
                        DragonController dragon = listDragon[i].GetComponent <DragonController>();
                        if (dragon.StateAction == EDragonStateAction.IDLE)
                        {
                            attackPlayerDragon(dragon);
                            break;
                        }
                    }
                    else
                    {
                        BabyDragonController baby = listDragon[i].GetComponent <BabyDragonController>();
                        if (baby.StateAction == EDragonStateAction.IDLE)
                        {
                            attackBabyDragon(baby);
                            break;
                        }
                    }
                }
            }

            if (hasTarget)
            {
                controller.stateAttack.target = null;
                controller.stateMove.State    = EEnemyMovement.MOVE_ON_PATHS;
                controller.StateAction        = EEnemyStateAction.MOVE;
            }
        }
        else
        {
            controller.stateAttack.target = null;
            controller.stateMove.State    = EEnemyMovement.MOVE_ON_PATHS;
            controller.StateAction        = EEnemyStateAction.MOVE;
        }
    }
示例#24
0
    void initDragon()
    {
        PlayerDragon = Instantiate(Resources.Load <GameObject>("Prefab/Dragon/Player/Dragon")) as GameObject;
        PlayerDragon.transform.parent        = PlayManager.Instance.Temp.Dragon.transform;
        PlayerDragon.transform.localPosition = Vector3.zero;
        PlayerDragon.transform.localScale    = Vector3.one;

        //Stretch HP
        PlayerDragon.transform.GetChild(1).GetComponent <UIStretch>().container = GameObject.FindWithTag("Root");

        dragonController = PlayerDragon.GetComponent <DragonController>();

        //Stretch selected arrow
        dragonController.selected.transform.GetChild(0).GetComponent <UIStretch>().container = PlayManager.Instance.tempInit.cameraRender;
    }
示例#25
0
    /// <summary>
    /// Raises the dragon crashed event.
    /// </summary>
    public void OnDragonCrashed()
    {
        // Get player's replay data
        DragonController controller = dragon.GetComponent <DragonController> ();

        playerData.JumpData = controller.JumpData;

        Scroller scroller = dragon.GetComponent <Scroller> ();

        playerData.BonusData = scroller.BonusData;

        isPlayerDied = true;

        UpdatePlayerDataToDatabase();
    }
示例#26
0
 public IDragonState HandleInput(DragonController dragonController, IHandleInput input)
 {
     if (input.Move() == Vector3.zero)
     {
         return(new IdlingState());
     }
     else if (input.Move() != Vector3.zero)
     {
         return(new RunningState());
     }
     else
     {
         return(null);
     }
 }
示例#27
0
    // Start is called before the first frame update
    void Start()
    {
        dragCon = GameObject.Find("DragonIndicator_Flame").GetComponent <DragonController>();

        locked      = true;
        powerBar    = GetComponent <Slider> ();
        dragonImage = dragonObj.GetComponent <Image>();

        gyro  = new Vector3(0, 0, 0);
        accel = new Vector3(0, 0, 0);
        // get the public Joycon array attached to the JoyconManager in scene
        joycons = JoyconManager.Instance.j;
        j       = joycons[jc_ind];
        if (joycons.Count < jc_ind + 1)
        {
            Destroy(gameObject);
        }
    }
示例#28
0
    public IDragonState HandleInput(DragonController dragon, IHandleInput input)
    {
        Debug.Log("Flinchstate Active");
        if (dragon.isFlinching)
        {
            return(null);
        }

        if (input.Move() == Vector3.zero)
        {
            return(new IdlingState());
        }
        else if (input.Move() != Vector3.zero)
        {
            return(new RunningState());
        }
        else
        {
            return(null);
        }
    }
示例#29
0
    public DragonChase(UnityEngine.Vector3[] wayPoints, DragonController dragonController)
    {
        // TODO: Complete member initialization
        this.wayPoints        = wayPoints;
        this.dragonController = dragonController;
        actionID = (int)DragonController.FSMActionID.Chase;

        animator = dragonController.Animator;

        if (dragonController.ActionType == E_ActionType.SpecialCircle && wayPoints != null && wayPoints.Length != 0)
        {
            destPos = wayPoints[1];
        }
        if (dragonController.ActionType == E_ActionType.ShakeScreen)
        {
            AreaManager.Instance.GetRandomPositionInArea(dragonController.stayArea, ref destPos);
        }

        curIndex = 0;

        info.name = "run";
        info.id   = 1;
    }
 void Awake()
 {
     mydrago = GetComponent <DragonController>();
 }
 void Start()
 {
     controller = GetComponent<DragonController>();
 }
示例#32
0
 void Start()
 {
     dragon = DragonController.FindObjectOfType <DragonController> ();
 }
 void Start()
 {
     controller = transform.parent.GetComponent<DragonController>();
     listEnemy = new System.Collections.Generic.List<GameObject>();
 }
 void OnEnable()
 {
     animationFrames = GetComponent<AnimationFrames>();
     controller = transform.parent.GetComponent<DragonController>();
 }