Esempio n. 1
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (other.tag == "Player")
     {
         other.gameObject.GetComponent <AnimateEntity>().stun      = true;
         other.gameObject.GetComponent <Rigidbody2D>().constraints = RigidbodyConstraints2D.FreezeAll;
         RootManager newRoot = Instantiate(constrictRoot, other.transform.position, Quaternion.identity);
         newRoot.setTarget(other.gameObject);
         Destroy(gameObject);
     }
 }
Esempio n. 2
0
    private void Awake()
    {
        rootManager       = FindObjectOfType <RootManager>();
        resourceManager   = FindObjectOfType <ResourceManager>();
        rigidbody         = GetComponent <Rigidbody2D>();
        this.IsInvincible = false;

        gameManager = GameManager.GetInstance();

        Vector2 start  = new Vector2(0, 0);
        Vector2 target = Vector2.right;

        targetRotation = rigidbody.rotation;

        if (currentRoot == null)
        {
            currentRoot = rootManager.GetCurrent();
            if (currentRoot == null)
            {
                rootManager.CreateNewVisual(transform.position);
                currentRoot = rootManager.GetCurrent();
                // Create a second point that will be move to the player's location
                currentRoot.AddPoint(transform.position);
                currentIndex = currentRoot.GetPointCount();
                lastPosition = transform.position;
            }
        }

        input = new PlayerInput();
        input.SeedControls.Movement.performed += (ctx) => movementInput = ctx.ReadValue <Vector2>();

        input.SeedControls.Kill.performed += (ctx) =>
        {
            if (gameManager.ActiveState == GameState.Active)
            {
                gameManager.SetState(GameState.Dead);
            }
        };

        input.SeedControls.Select.performed += (ctx) =>
        {
            if (gameManager.ActiveState == GameState.Retreat)
            {
                if (resourceManager.IsWaterDrained == false)
                {
                    gameManager.SetState(GameState.Aim);
                }
            }
            else if (gameManager.ActiveState == GameState.Aim)
            {
                ExitRetreat();
            }
        };

        input.SeedControls.Cancel.performed += (ctx) =>
        {
            if (gameManager.ActiveState == GameState.Aim)
            {
                gameManager.SetState(GameState.Retreat);
            }
        };
    }
Esempio n. 3
0
    private void LoadManager_Editor()
    {
        RootManager manager_go = Resources.Load <RootManager>(ManagerResourcesPath + ManagerType);

        Instantiate(manager_go);
    }