Example #1
0
    public override State Update()
    {
        FireSlime2AI fireSlime2AI = (FireSlime2AI)GetAI();
        FireSlime2   fireSlime2   = (FireSlime2)fireSlime2AI.getCharacter();
        GameObject   myBody       = fireSlime2.GetGameObject();

        if (currentRushTime < rushTime)
        {
            currentRushTime += Time.deltaTime;
            Vector3 dir = (fireSlime2.currentTarget.transform.position - myBody.transform.position).normalized;
            preSpeed = dir * rushSpeed * Time.deltaTime;
            myBody.GetComponent <Rigidbody2D>().velocity = preSpeed;

            float distance = Vector2.Distance(fireSlime2.currentTarget.transform.position, myBody.transform.position);
            if (distance < 0.5f)
            {
                fireSlime2.currentTarget.GetComponent <Player>().UnderAttack(1);
                GameObject.Destroy(myBody);
            }
        }
        else
        {
            currentState = State.SUCESSED;
        }
        return(State.RUNNING);
    }
Example #2
0
    public override void Enter()
    {
        base.Enter();
        FireSlime2AI fireSlime2AI = (FireSlime2AI)GetAI();
        FireSlime2   fireSlime2   = (FireSlime2)fireSlime2AI.getCharacter();

        currentRushTime = 0;
        isStart         = true;
        preSpeed        = Vector3.zero;
    }
Example #3
0
    public override void Enter()
    {
        base.Enter();
        FireSlime2AI fireSlime2AI = (FireSlime2AI)GetAI();
        FireSlime2   fireSlime2   = (FireSlime2)fireSlime2AI.getCharacter();
        GameObject   myBody       = fireSlime2.GetGameObject();

        if (childrenStates.Count == 0)
        {
            childrenStates.Add(fireSlime2AI.GetRushState());
            fireSlime2AI.GetRushState().currentState = State.NONE;
        }
    }
Example #4
0
    public override void Enter()
    {
        base.Enter();

        FireSlime2AI fireSlime2AI = (FireSlime2AI)GetAI();
        FireSlime2   fireSlime2   = (FireSlime2)fireSlime2AI.getCharacter();

        if (childrenStates.Count == 0)
        {
            AddChild(fireSlime2AI.GetConditionHaveBumpIntoTheWall());
            fireSlime2AI.GetConditionHaveBumpIntoTheWall().currentState = State.NONE;
            AddChild(fireSlime2AI.GetVertigo());
            fireSlime2AI.GetVertigo().currentState = State.NONE;
        }
    }
Example #5
0
    // Use this for initialization
    void Start()
    {
        for (int i = 0; i < fireSlimeBodies.Count; i++)
        {
            FireSlime fireSlime = new FireSlime(fireSlimeBodies[i], new FireSlimeAI(), new FireSlimeAttr(30, 5, 300, 0.5f, 8, new FireSlime1AtrrStrategy()), fusedLaser);
            fireSlimeBodies[i].SetActive(false);
            remainEnemys.Add(fireSlime);
        }

        for (int i = 0; i < fireSlime1Bodies.Count; i++)
        {
            FireSlime1 fireSlime1 = new FireSlime1(fireSlime1Bodies[i], new FireSlime1AI(), new FireSlimeAttr(30, 10, 300, 1f, 10, new FireSlime1AtrrStrategy()), meltedBomb);
            remainEnemys.Add(fireSlime1);
            fireSlime1Bodies[i].SetActive(false);
        }

        for (int i = 0; i < fireSlime2Bodies.Count; i++)
        {
            FireSlime2 fireSlime2 = new FireSlime2(fireSlime2Bodies[i], new FireSlime2AI(), new FireSlime2Attr(15, 5, 350, 0.4f, 8, new FireSlime2AttrStrategy()), iFire, rushFire);
            remainEnemys.Add(fireSlime2);
            fireSlime2Bodies[i].SetActive(false);
        }
        //InitEnemys();

        inDoor.SetActive(true);
        inDoor.GetComponent <SpriteRenderer>().sprite = CloseDoorSprite;

        inDoor.GetComponent <InDoor_FireSlimeScene>().SetRoom(this);
        outDoor.SetActive(true);
        outDoor.tag   = "Wall";
        outDoor.layer = LayerMask.NameToLayer("Wall");
        outDoor.GetComponent <SpriteRenderer>().sprite = CloseDoorSprite;

        for (int i = 0; i < prePos.Length; i++)
        {
            prePos[i] = -1;
        }

        for (int i = 0; i < spawnPostions.Count; i++)
        {
            GameObject iTarget = Instantiate(target, spawnPostions[i].transform.position, Quaternion.identity);
            targets.Add(iTarget);
        }
    }
Example #6
0
    public override State Update()
    {
        FireSlime2AI fireSlime2AI = (FireSlime2AI)GetAI();
        FireSlime2   fireSlime2   = (FireSlime2)fireSlime2AI.getCharacter();
        GameObject   myBody       = fireSlime2.GetGameObject();

        if (fireSlime2.currentTarget != null)
        {
            return(State.SUCESSED);
        }

        fireSlime2.targets = Physics2D.OverlapCircleAll(myBody.transform.position, eyeViewDistance, LayerMask.GetMask("Player"));
        Collider2D[] targets = fireSlime2.targets;
        Collider2D   currentTarget;

        if (targets != null && targets.Length != 0)
        {
            fireSlime2.currentTarget = targets[0];
            currentTarget            = targets[0];
            return(State.SUCESSED);
        }
        return(State.FAILED);
    }
Example #7
0
 public void SetOwner(FireSlime2 owner)
 {
     this.owner = owner;
 }
Example #8
0
 public void SetOwner(FireSlime2 Owner)
 {
     this.Owner = Owner;
 }