예제 #1
0
    public void SetVisionModule(VisionModule visionModule)
    {
        this.visionModule = (VisionModule)visionModule;
        visionScale       = this.visionModule.GetVisionScale();

        transform.localScale = new Vector3(visionScale.x, visionScale.y, transform.localScale.z);
    }
예제 #2
0
    protected void GetModules()
    {
        Modules = new Dictionary <string, NPCModule>();
        foreach (KeyValuePair <string, string> entry in NPCModuleTypes)
        {
            NPCModule module = (NPCModule)GetComponent(entry.Value);
            Modules.Add(entry.Key, module);
        }
        ;

        combatModule         = (CombatModule)Modules["Combat"];
        movementModule       = (MovementModule)Modules["Movement"];
        bounceModule         = (BounceModule)Modules["Bounce"];
        handleOpponentModule = (HandleOpponentModule)Modules["HandleOpponent"];
        visionModule         = (VisionModule)Modules["Vision"];
    }
예제 #3
0
    protected override void Awake()
    {
        base.Awake();

        // Getting all modules
        this.collisionModule = this.GetComponent <CollisionCheckModule>();
        this.visionModule    = this.GetComponent <VisionModule>();
        this.aliveModule     = this.GetComponent <Alive>();
        this.goldModule      = this.GetComponent <GoldDropModule>();

        this.jumpModule   = this.TryGetComponent(out Jump jump) ? jump : null;
        this.attackModule = this.TryGetComponent(out Attack attack) ? attack : null;

        // Settings events
        this.myMotor.onTouchWall  += OnTouchWall;
        this.aliveModule.onDamage += OnDamage;
        this.aliveModule.onDie    += () => { dieNextFrame = true; goldModule.Spawn(); };
    }