コード例 #1
0
ファイル: Creature.cs プロジェクト: eddietree/NeuralGnats
    void Start()
    {
        thrusterLeft  = CreateThruster(thrusterLeftMount);
        thrusterRight = CreateThruster(thrusterRightMount);
        thrusterProto.SetActive(false);

        lifeSpan = lifeSpanMax;

        // add death state
        eventDeath += () =>
        {
            eventEatFood = null;

            rb.velocity        = Vector2.zero;
            rb.angularVelocity = 0.0f;

            thrusterLeft.gameObject.SetActive(false);
            thrusterRight.gameObject.SetActive(false);

            GetComponent <BoxCollider2D>().enabled = false;
            GetComponent <SpriteRenderer>().color  = Color.gray;

            this.StopAndNullify(ref threadMoving);
        };

        threadMoving = StartCoroutine(HandleMovement());
    }
コード例 #2
0
ファイル: Creature.cs プロジェクト: provencher/NeuralGnats
    void Start()
    {
        thrusterLeft  = CreateThruster(thrusterLeftMount);
        thrusterRight = CreateThruster(thrusterRightMount);
        thrusterProto.SetActive(false);

        Reset();
    }
コード例 #3
0
ファイル: Creature.cs プロジェクト: eddietree/NeuralGnats
    CreatureThruster CreateThruster(Transform parent)
    {
        var thrusterObj = GameObject.Instantiate(thrusterProto);

        thrusterObj.transform.SetParent(parent, false);
        thrusterObj.transform.localPosition = Vector3.zero;
        thrusterObj.transform.localRotation = Quaternion.identity;

        CreatureThruster thruster = thrusterObj.GetComponent <CreatureThruster>();

        return(thruster);
    }