Exemplo n.º 1
0
    // Start is called before the first frame update
    void Start()
    {
        playerAgent = PlayerCompleteBodyController.playerCompleteBodyController.GetBody();

        InitializeEquipmentPanel();
        InitializeFinancePanel();
    }
Exemplo n.º 2
0
    public virtual float TakeDamage(CompleteBody casterAgent, float damage)
    {
        float trueDamage = damage;

        health -= trueDamage;
        return(trueDamage);
    }
Exemplo n.º 3
0
 public virtual void Reload(CompleteBody completeBodyActivator)
 {
     if ((int)completeBodyActivator.GetHealthState() >= (int)HealthState.Capable && completeBodyActivator.GetFinanceQuantityArray()[ammunitionType] > 0)
     {
         int reloadAmmunitionCount = Math.Min((int)completeBodyActivator.GetFinanceQuantityArray()[ammunitionType], magazineCapacity - magazineCount);
         magazineCount += reloadAmmunitionCount;
         completeBodyActivator.GetFinanceQuantityArray()[ammunitionType] -= reloadAmmunitionCount;
     }
 }
Exemplo n.º 4
0
 protected virtual void OnTriggerExit2D(Collider2D collider)
 {
     if (collider.name == "Body" || collider.name == "Head")
     {
         CompleteBody collisionGameObjectCompleteBody = collider.GetComponentInParent <CompleteBody>();
         //Debug.Log("trigger exit " + collisionGameObjectEntity + " " + collider.name);
         if (collisionGameObjectCompleteBody != completeBodyActivator && collider.name == "Body")
         {
             GetComponent <Rigidbody2D>().drag        -= collisionGameObjectCompleteBody.viscosity;
             GetComponent <Rigidbody2D>().angularDrag -= collisionGameObjectCompleteBody.viscosity;
         }
     }
 }
Exemplo n.º 5
0
 protected virtual void OnTriggerStay2D(Collider2D collider)
 {
     if (collider.name == "Body" || collider.name == "Head")
     {
         CompleteBody collisionGameObjectCompleteBody = collider.GetComponentInParent <CompleteBody>();
         // Debug.Log("trigger stay " + collisionGameObjectEntity + " " + collider.name + " velocity ");
         if (collisionGameObjectCompleteBody.GetAffinity() != completeBodyActivator.GetAffinity())
         {
             float speedFactor = Mathf.Pow((GetComponent <Rigidbody2D>().velocity - collisionGameObjectCompleteBody.GetComponent <Rigidbody2D>().velocity).magnitude / initialVelocity, 2);
             float damage      = baseDamage * speedFactor;
             collisionGameObjectCompleteBody.TakeDamage(completeBodyActivator, damage);
             // Debug.Log(speedFactor);
             // Debug.Log(damage);
         }
     }
 }
Exemplo n.º 6
0
 void Start()
 {
     playerAgent   = PlayerCompleteBodyController.playerCompleteBodyController.GetBody();
     bodyAgentList = new List <CompleteBody>()
     {
         playerAgent, debugAgent
     };
     healthRingFillList = new List <GameObject>();
     for (int b = 0; b < bodyAgentList.Count; b++)
     {
         GameObject healthPieFill = Instantiate(healthRingFillPrefab);
         healthRingFillList.Add(healthPieFill);
         healthPieFill.transform.SetParent(transform, false);
         healthPieFill.GetComponent <HealthRingMeter>().body = bodyAgentList[b];
     }
 }
Exemplo n.º 7
0
    public float baseDamage;        // set in inspector

    public override void Actuate(IActivator activator, Dictionary <object, object> argumentDictionary = null)
    {
        CompleteBody completeBodyActivator = (CompleteBody)activator;

        Vector2 headPosition = completeBodyActivator.transform.TransformPoint(completeBodyActivator.headPosition);

        // PrefabReferences.prefabReferences.bullet.SetActive(false);  // done in inspector/editor now  // https://answers.unity.com/questions/636079/assign-exposed-vars-before-instantianting-prefab.html
        GameObject projectileGameObject = Instantiate(PrefabReferences.prefabReferences.bullet, headPosition, completeBodyActivator.transform.rotation);

        ISpirit spirit = projectileGameObject.GetComponent <Spirit>();

        spirit.SetAffinity(completeBodyActivator.GetAffinity());
        Projectile projectile = projectileGameObject.GetComponent <Projectile>();

        projectile.completeBodyActivator = completeBodyActivator;
        projectile.timeout         = projectileTimeout;
        projectile.initialVelocity = initialVelocity;
        projectile.baseDamage      = baseDamage;

        projectileGameObject.SetActive(true);
        projectileGameObject.GetComponent <Rigidbody2D>().velocity = projectileGameObject.transform.TransformDirection(new Vector2(0, projectile.initialVelocity));
        projectileGameObject.GetComponent <Collider2D>().enabled   = true;
    }
Exemplo n.º 8
0
 public float TakeDamage(CompleteBody casterAgent, float damage)
 {
     return(healthBody.TakeDamage(casterAgent, damage));
 }
Exemplo n.º 9
0
 protected override void Awake()
 {
     base.Awake();
     completeBody = GetComponent <CompleteBody>();
 }