Exemple #1
0
 public void release(IndieMarc.TopDown.CharacterEmployee value)
 {
     emplPool.Remove(value);
     emplPoolArchive.Add(value);
     value.transform.SetParent(deactivatedPool);
     value.gameObject.SetActive(false);
 }
Exemple #2
0
        public void EmployeeAdd(Vector3 spawnPosition)
        {
            if (spawnPosition == Vector3.zero)
            {
                Vector2 spawnCircle = UnityEngine.Random.insideUnitCircle * 5;
                spawnPosition = new Vector3(transform.position.x + spawnCircle.x, transform.position.y + spawnCircle.y, transform.position.z);
            }

            CharacterEmployee newEmployee = ContainerEmploy.instance.getEmploy();

            newEmployee.setColor(playerColor);
            newEmployee.move_max           = PlayerMover.Instance.GetComponent <Character>().move_max;
            newEmployee.move_accel         = PlayerMover.Instance.GetComponent <Character>().move_accel;
            newEmployee.move_deccel        = PlayerMover.Instance.GetComponent <Character>().move_deccel;
            newEmployee.transform.position = spawnPosition;
            newEmployee.transform.rotation = transform.rotation;



            newEmployee.owner = this;
            employeesList.Add(newEmployee);
            // if (employeesCount < employeesList.Count) employeesCount = employeesList.Count;

            AudioManager.Instance.PlaySound("Join");
        }
        private void OnTriggerEnter2D(Collider2D other)
        {
            CharacterEmployee enemy = other.GetComponent <CharacterEmployee>();

            if (enemy && enemy.owner != owner && enemy.owner != null)
            {
                if (owner.getEmployeesCount() > enemy.owner.getEmployeesCount())
                {
                    enemy.owner.EmployeeRemove();
                }
            }
        }
Exemple #4
0
    public IndieMarc.TopDown.CharacterEmployee getEmploy()
    {
        if (emplPoolArchive.Count > 0)
        {
            IndieMarc.TopDown.CharacterEmployee value = emplPoolArchive[0];
            emplPoolArchive.RemoveAt(0);
            emplPool.Add(value);

            value.transform.SetParent(null);
            value.gameObject.SetActive(true);
            return(value);
        }
        else
        {
            IndieMarc.TopDown.CharacterEmployee value = Instantiate(prefabEmpl);
            emplPool.Add(value);
            return(value);
        }
    }