示例#1
0
    private void HandleInteractionInput()
    {
        if (interactablesCollisionList.Count > 0)
        {
            HoleScript hole = interactablesCollisionList[0].GetComponent <HoleScript>();
            if (hole)
            {
                exclamationMark.SetActive(false);
                hole.HoleBehaviour();
            }

            FountainScript fountain = null;
            if (interactablesCollisionList.Count > 0)
            {
                fountain = interactablesCollisionList[0].GetComponent <FountainScript>();
            }
            if (fountain)
            {
                exclamationMark.SetActive(false);
                fountain.OpenFountain();
            }


            BuffsList buffScroll = null;
            if (interactablesCollisionList.Count > 0)
            {
                buffScroll = interactablesCollisionList[0].GetComponent <BuffsList>();
            }
            if (buffScroll)
            {
                exclamationMark.SetActive(false);
                buffScroll.OpenBuffPanel();
            }
        }
    }
示例#2
0
    void Start()
    {
        isBurning      = false;
        isBroken       = false;
        fountainScript = null;
        isFurniture    = type == TaskType.Furniture;
        isNPC          = type == TaskType.NPC;
        isInteractable = false;
        taskCollider   = GetComponent <Collider2D>();
        taskRenderer   = GetComponent <SpriteRenderer>();
        originalSize   = taskRenderer.bounds.size;
        if (type == TaskType.Sweep)
        {
            interactCollider = GetComponent <BoxCollider2D>();
        }
        else
        {
            interactCollider = GetComponent <CircleCollider2D>();
        }
        animator = GetComponent <Animator>();
        if (type == TaskType.Fire)
        {
            fireScript = GetComponent <FireScript>();
        }

        MyGameManager.Instance.addTask(this);

        duration = duration / 2;

        initialDuration = duration;

        if (isFurniture)
        {
            animator.SetInteger("Furniture", (int)furnitureType);
            if (canLeak())
            {
                fountainScript = gameObject.AddComponent <FountainScript>();
                fountainGO     = Instantiate(Resources.Load("WaterFountain"), transform.position, Quaternion.identity) as GameObject;
                Bounds bounds = fountainGO.GetComponent <SpriteRenderer>().bounds;
                fountainGO.transform.position += new Vector3(0, bounds.extents.y / 3);
                fountainGO.SetActive(false);
                fountainScript.enabled = false;
            }
        }

        if (isNPC)
        {
            animator.SetInteger("NPC", (int)NPCType);
            enemyAI = GetComponent <EnemyAI>();
        }

        initForLevel();
    }
示例#3
0
 private void Awake()
 {
     instance = this;
 }